Mark Notification Read
You can use the following function from the LikeMinds Android SDK to mark the notifications that have been clicked by user in your application, as read.
Steps to mark a notification as read
- Create a MarkReadNotificationRequest object using
MarkReadNotificationRequest.Builder
class by passing all the required parameters. - Call
markReadNotification()
function using the instance ofLMFeedClient
. - Process the response (
LMResponse<Nothing>
) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of MarkReadNotificationRequest
val markReadNotificationRequest = MarkReadNotificationRequest.Builder()
.activityId("ENTER ACTIVITY ID") // id of the notification activity which is to be marked as read
.build()
// get response (LMResponse<Nothing>)
val response = LMFeedClient.getInstance().markReadNotification(markReadNotificationRequest)
if (response.success) {
// your function to process the response dataa
processNotificationRead(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}
MarkReadNotificationRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
activityId | String | ID of the notification activity which is to be marked as read. |